package com.example.dingdong.daomain;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.alibaba.fastjson.annotation.JSONField;

/**
 * @ClassName: BasicUserEntity
 * @Description:用户实体类 
 * @Author :chengwenixng
 * @Copyright: Smartlab411
 * @DateTime 2021-06-03 23:10:02
 */
@Entity
@Table(name ="basicUser_entity")
public class BasicUserEntity implements Serializable{

	private static final long serialVersionUID = 1L;

	/**
	 * 数据库自增长ID
	 */
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Long id;
	
	/**
	 * 删除标识
	 */
	private boolean delFlag = true;
	/**
	 * 用户账号
	 */
	private String account;
	
	/**
	 * 用户密码
	 */
	private String password;
	/**
	 * 用户姓名
	 */
	private String userName;
	/**
	 * 用户手机号
	 */
	private String phone;
	/**
	 * 用户邮箱
	 */
	private String email;
	/**
	 * 地址
	 */
	private String address;
	/**
	 * 头像路径
	 */
	private String headPicturePath;
	/**
	 * 基础用户-管理员（一对一）
	 */
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private AdminEntity adminEntity;
	
	/**
	 * 基础用户-Boss（一对一）
	 */
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private BossEntity bossEntity;
	
	/**
	 * 基础用户-买方（一对一）
	 */
	@OneToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private ClientEntity clientEntity;
	
	/**
	 * 用户-菜品（一对多）
	 */
	@OneToMany(mappedBy = "basicUserEntity", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<MenuEntity> menuEntityList = new ArrayList<>();
	/**
	 * 基础用户-角色（多对一）
	 */
	@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private RoleEntity roleEntity;
	
	/**
	 * 用户-订单（一对多）
	 */
	@JSONField(serialize = false)
	@OneToMany(mappedBy = "basicUserEntity", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<OrderRecordEntity> orderRecordEntityList = new ArrayList<>();
	
	/**
	 * 用户-角色（多对多）
	 */
	@JSONField(serialize = false)
	@ManyToMany(mappedBy = "joinBasicUserList", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	private List<RoleEntity> roleList = new ArrayList<>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public boolean isDelFlag() {
		return delFlag;
	}

	public void setDelFlag(boolean delFlag) {
		this.delFlag = delFlag;
	}

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getHeadPicturePath() {
		return headPicturePath;
	}

	public void setHeadPicturePath(String headPicturePath) {
		this.headPicturePath = headPicturePath;
	}

	public AdminEntity getAdminEntity() {
		return adminEntity;
	}

	public void setAdminEntity(AdminEntity adminEntity) {
		this.adminEntity = adminEntity;
	}

	public BossEntity getBossEntity() {
		return bossEntity;
	}

	public void setBossEntity(BossEntity bossEntity) {
		this.bossEntity = bossEntity;
	}

	public ClientEntity getClientEntity() {
		return clientEntity;
	}

	public void setClientEntity(ClientEntity clientEntity) {
		this.clientEntity = clientEntity;
	}

	public List<MenuEntity> getMenuEntityList() {
		return menuEntityList;
	}

	public void setMenuEntityList(List<MenuEntity> menuEntityList) {
		this.menuEntityList = menuEntityList;
	}

	public RoleEntity getRoleEntity() {
		return roleEntity;
	}

	public void setRoleEntity(RoleEntity roleEntity) {
		this.roleEntity = roleEntity;
	}

	public List<OrderRecordEntity> getOrderRecordEntityList() {
		return orderRecordEntityList;
	}

	public void setOrderRecordEntityList(List<OrderRecordEntity> orderRecordEntityList) {
		this.orderRecordEntityList = orderRecordEntityList;
	}

	public List<RoleEntity> getRoleList() {
		return roleList;
	}

	public void setRoleList(List<RoleEntity> roleList) {
		this.roleList = roleList;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
}
